You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@fluentui/style-utilities

Package Overview
Dependencies
Maintainers
12
Versions
129
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fluentui/style-utilities

Styling helpers for Fluent UI React.


Version published
Weekly downloads
149K
decreased by-1.8%
Maintainers
12
Created
Weekly downloads
 

Package description

What is @fluentui/style-utilities?

@fluentui/style-utilities is a utility library for styling in the Fluent UI ecosystem. It provides a set of functions and utilities to help with theming, styling, and responsive design in React applications.

What are @fluentui/style-utilities's main functionalities?

Theming

Theming allows you to create a consistent look and feel across your application by defining a set of colors and styles. The `createTheme` function helps you generate a theme object that can be used throughout your application.

const { createTheme } = require('@fluentui/style-utilities');

const myTheme = createTheme({
  palette: {
    themePrimary: '#0078d4',
    themeLighterAlt: '#eff6fc',
    themeLighter: '#deecf9',
    themeLight: '#c7e0f4',
    themeTertiary: '#71afe5',
    themeSecondary: '#2b88d8',
    themeDarkAlt: '#106ebe',
    themeDark: '#005a9e',
    themeDarker: '#004578',
    neutralLighterAlt: '#f8f8f8',
    neutralLighter: '#f4f4f4',
    neutralLight: '#eaeaea',
    neutralQuaternaryAlt: '#dadada',
    neutralQuaternary: '#d0d0d0',
    neutralTertiaryAlt: '#c8c8c8',
    neutralTertiary: '#c2c2c2',
    neutralSecondary: '#858585',
    neutralPrimaryAlt: '#4b4b4b',
    neutralPrimary: '#333333',
    neutralDark: '#272727',
    black: '#1d1d1d',
    white: '#ffffff'
  }
});

Responsive Design

Responsive design utilities help you create styles that adapt to different screen sizes. The `getScreenSelector` function returns a media query string for a given breakpoint, which can be used to apply styles conditionally.

const { getScreenSelector } = require('@fluentui/style-utilities');

const screenSelector = getScreenSelector('medium');

const styles = {
  root: {
    [screenSelector]: {
      backgroundColor: 'blue'
    }
  }
};

Style Merging

Style merging allows you to combine multiple style objects into a single class name. The `mergeStyles` function takes one or more style objects and returns a class name that can be applied to a component.

const { mergeStyles } = require('@fluentui/style-utilities');

const classNames = mergeStyles({
  backgroundColor: 'red',
  selectors: {
    ':hover': {
      backgroundColor: 'blue'
    }
  }
});

Other packages similar to @fluentui/style-utilities

Readme

Source

@fluentui/style-utilities

Styling helpers for Fluent UI React (formerly Office UI Fabric React)

Using this package

Integrating components into your project depends heavily on your setup. The recommended setup is to use a bundler such as webpack which can resolve NPM package imports in your code and can bundle the specific things you import.

If you're using @fluentui/react, the @fluentui/style-utilities package contents are re-exported under @fluentui/react/lib/Styling. It's recommended to access the package this way rather than via a direct dependency.

In a project which doesn't use @fluentui/react, you can still install this package as a dependency:

npm install --save @fluentui/style-utilities

This gives you access to styling-related constants, utilities, and Fabric Core style classes through JavaScript.

FAQs

Package last updated on 01 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc